//
//  ItemView.swift
//  SnapKitTest
//
//  Created by jin on 2024/8/14.
//

import UIKit
import TangramKit

class ItemView: TGRelativeLayout {

    init() {
        super.init(frame: CGRect.zero)
        innerInit()
    }

    required init?(coder: NSCoder) {
        super.init(coder: coder)
        innerInit()
    }
    
    func innerInit(){
        backgroundColor = .white
        tg_width.equal(.fill)
        tg_height.equal(55)
        
        addSubview(leftImgView)
        addSubview(rightImgView)
        addSubview(titleView)
    }

    ///左侧图标
    lazy var leftImgView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "Setting")
        
        imageView.tg_width.equal(20)
        imageView.tg_height.equal(20)
        imageView.tg_left.equal(16)
        imageView.tg_centerY.equal(0)
        return imageView
    }()
    
    ///右侧图标
    lazy var rightImgView: UIImageView = {
        let imageView = UIImageView()
        imageView.image = UIImage(named: "Arrow")
        
        imageView.tg_width.equal(20)
        imageView.tg_height.equal(20)
        imageView.tg_right.equal(16)
        imageView.tg_centerY.equal(0)
        return imageView
    }()
    
    ///标题
    lazy var titleView: UILabel = {
        let textView = UILabel()
        textView.text = "标题"
        
        textView.tg_width.equal(.wrap)
        textView.tg_height.equal(.wrap)
        textView.tg_left.equal(leftImgView.tg_right).offset(16)
        textView.tg_centerY.equal(0)
        return textView
    }()

}
